using System;
using System.Data;
using System.Collections.Generic;
namespace eTMS.DAO{
	/********************************BEGIN UsersDAO****************************************/
	///<summary>
	/// <para>Author: Auto generated class by CSharp Code Generator v2.0</para>
	/// <para>Date:10/08/2010 58:03:30</para>
	/// <para>Class Name: UsersDAO</para>
	/// <para>Description: Class access to table Users in database. Class for coder code here</para>
	///</summary>

	
	public  class UsersDAO : UsersDAOBase{
        public DataSet SelectAllDSAccessibleModule(int User_ID)
        {
            IDbCommand cmd = this.CreateCommand();
            cmd.CommandText = @"SELECT  Menus.Module_ID
                                FROM    UserRole INNER JOIN
                                        MenuRole ON UserRole.Role_ID = MenuRole.Role_ID INNER JOIN
                                        Menus ON MenuRole.Menu_ID = Menus.Menu_ID
                                WHERE UserRole.User_ID=" + User_ID.ToString();
            return this.SelectDS(cmd);
        }
        public DataSet SelectAllDSPageModuleName(int User_ID)
        {
            IDbCommand cmd = this.CreateCommand();
            cmd.CommandText = @"SELECT      DISTINCT PortalPages.ModuleName
                                FROM            PageLayOutPermission INNER JOIN
                                                PageLayOut ON PageLayOutPermission.PageLayOut_ID = PageLayOut.PageLayOut_ID INNER JOIN
                                             PortalPages ON PageLayOut.PortalPage_ID = PortalPages.PortalPage_ID INNER JOIN
                                             Roles ON PageLayOutPermission.Role_ID = Roles.Role_ID INNER JOIN
                                             UserRole ON Roles.Role_ID = UserRole.Role_ID
                                WHERE UserRole.User_ID=" + User_ID.ToString();
            DataSet ds= this.SelectDS(cmd);

            cmd.CommandText = @"SELECT      DISTINCT PortalPages.ModuleName
                                FROM         PageLayOut INNER JOIN
                                             PortalPages ON PageLayOut.PortalPage_ID = PortalPages.PortalPage_ID 
                                WHERE PageLayOut.PermissionType=0 AND PageLayOut.PortletPosition<>1 AND PageLayOut.PortletPosition<>5";
            DataSet ds1=this.SelectDS(cmd);
            foreach (DataRow row in  ds1.Tables[0].Rows)
            {
                ds.Tables[0].ImportRow(row);
            }
            return ds;
        }
        
	}
	/*****************************************************************************************************/
	/**********************************END UsersDAO*****************************************/
	/*****************************************************************************************************/
}

